<template>
  <div>
    <SelectGoodsCate v-model="checkList" />
    <el-table border :data="tableData">
      <el-table-column type="selection"></el-table-column>
      <el-table-column
        type="index"
        prop="goods_id"
        label="ID"
        align="center"
      ></el-table-column>
      <el-table-column
        prop="goods_name"
        label="商品名称"
        width="450"
      ></el-table-column>
      <el-table-column prop="goods_price" label="价格"></el-table-column>
      <el-table-column prop="goods_number" label="数量"></el-table-column>
      <el-table-column prop="goods_state" label="状态">
        <template slot-scope="scope">
          <el-tag v-if="scope.row.goods_state">通过</el-tag>
          <el-tag v-else>未通过</el-tag>
        </template>
      </el-table-column>
      <el-table-column prop="hot_mumber" label="是否热销">
        <template slot-scope="scope">
          <el-switch :value="scope.row.is_promote"> </el-switch>
        </template>
      </el-table-column>
      <el-table-column prop="add_time" label="创建时间" width="190">
        <template slot-scope="scope">
          {{ scope.row.add_time | formateTime }}
        </template>
      </el-table-column>
      <el-table-column label="操作" fixed="right" width="160">
        <template slot-scope="scope">
          <el-button size="mini" @click="handleEdit(scope.$index, scope.row)"
            >编辑</el-button
          >
          <el-button
            size="mini"
            type="danger"
            @click="handleDelete(scope.$index, scope.row)"
            >删除</el-button
          >
        </template>
      </el-table-column>
    </el-table>

    <!-- 分页区域 S-->
    <el-pagination
      background
      @size-change="handleSizeChange"
      @current-change="handleCurrentChange"
      :current-page.sync="q.pagenum"
      :page-sizes="[10, 20, 30, 50]"
      :page-size="q.pagesize"
      layout="total, sizes, prev, pager, next, jumper"
      :total="totalNum"
    >
    </el-pagination>
    <!-- 分页区域 E-->
  </div>
</template>

<script>
import list from "@/mixins/index";
export default {
  name: "goodscate",
  mixins: [list],
  data() {
    return {
      checkList:[],
    };
  },
  created() {
    this.$store.dispatch("cate/getCate");    
  },
  methods: {
    getGoods() {
      console.log("初始化商品分类");
    },
  },
};
</script>

<style>
</style>